import { StoreExt } from '@helpers/ReactExt'
import { action, computed, observable } from 'mobx'

interface Todo {
  content: string
  finished: boolean
}

class CreateStudentStore extends StoreExt<{}> {
  @observable
  public name: string = ''
  @observable
  public finished: boolean = false
  @observable
  public todos: Todo[] = []

  @computed
  get unfinishedTodoCount() {
    return this.todos.filter((todo) => !todo.finished).length
  }

  @action
  public modifyTodos(todo: Todo) {
    this.todos.push(todo)
  }
}

// tslint:disable-next-line:no-empty-interface
export interface CreateStudentModel extends CreateStudentStore {
  // TODO:
}
export default new CreateStudentStore()
